package com.web.manager.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.web.manager.pojo.Passage;
import com.web.manager.mapper.PassageMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
@Slf4j
public class PassageService extends ServiceImpl<PassageMapper, Passage> {

    @Resource
    private PassageMapper passageMapper;


    @Override
    public boolean save(Passage entity){


        return super.save(entity);

    }


    public Passage selectByUsername(String title){
        QueryWrapper<Passage> queryWrapper = new QueryWrapper<>(); //条件查询器
        queryWrapper.eq("title",title);  // ==> where username = #{username}


        // 根据用户名查询数据库的用户信息
        return  this.getOne(queryWrapper); // ==>select * from manager_user where username = #{username}
    }


}
